package net.apexes.demo.codegen.querydsl.qvar;

import static com.querydsl.core.types.PathMetadataFactory.*;
import com.querydsl.core.types.dsl.*;

import java.sql.Types;
import javax.annotation.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.PathMetadata;
import com.querydsl.sql.ColumnMetadata;
import com.querydsl.sql.ForeignKey;
import com.querydsl.sql.PrimaryKey;
import net.apexes.commons.querydsl.Index;
import net.apexes.demo.codegen.querydsl.entity.Goods;
import net.apexes.demo.codegen.querydsl.qvar.QGoodsBase;
import net.apexes.demo.codegen.querydsl.qvar.base.QEntityBase;

/**
 * QGoods is a Querydsl query type for Goods
 */
@Generated("net.apexes.codegen.core.MetadataSerializer")
public class QGoods extends QEntityBase<Goods> {

    private static final long serialVersionUID = -138219301;

    public static final QGoods $ = new QGoods("GOODS");

    public final StringPath goodsBaseId = createString("goodsBaseId");

    public final net.apexes.commons.querydsl.sql.EnumePath<net.apexes.demo.codegen.entity.enums.GoodsType> goodsType = createEnume("goodsType", net.apexes.demo.codegen.entity.enums.GoodsType.class);

    public final net.apexes.commons.querydsl.sql.EnumePath<net.apexes.demo.codegen.entity.enums.GoodsCategory> goodsCategory = createEnume("goodsCategory", net.apexes.demo.codegen.entity.enums.GoodsCategory.class);

    public final StringPath barCode = createString("barCode");

    public final StringPath skuCode = createString("skuCode");

    public final NumberPath<java.math.BigDecimal> price = createNumber("price", java.math.BigDecimal.class);

    public final NumberPath<Integer> seqOrder = createNumber("seqOrder", Integer.class);

    public final SimplePath<byte[]> photo = createSimple("photo", byte[].class);

    public final StringPath templateId = createString("templateId");

    public class PrimaryKeys {

        public final PrimaryKey<Goods> constraint4 = createPrimaryKey(id);

    }

    public final PrimaryKeys pk = new PrimaryKeys();

    public class ForeignKeys {

        public final ForeignKey<QGoodsBase> constraint40 = createForeignKey(goodsBaseId, "GOODS_BASE", "ID");

    }

    public final ForeignKeys fk = new ForeignKeys();

    public class Indexs {

        public final Index constraintIndex4 = index("CONSTRAINT_INDEX_4").column(goodsBaseId).build();

        public final Index ixGoodsSkuCode = index("IX_GOODS_SKU_CODE").column(skuCode).build();

        public final Index primaryKey4 = index("PRIMARY_KEY_4").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QGoods(String variable) {
        super(Goods.class, forVariable(variable), "PUBLIC", "GOODS");
        addMetadata();
    }

    public QGoods(String variable, String schema, String table) {
        super(Goods.class, forVariable(variable), schema, table);
        addMetadata();
    }

    public QGoods(Path<? extends Goods> path) {
        super(path.getType(), path.getMetadata(), "PUBLIC", "GOODS");
        addMetadata();
    }

    public QGoods(PathMetadata metadata) {
        super(Goods.class, metadata, "PUBLIC", "GOODS");
        addMetadata();
    }

    public void addMetadata() {
        addMetadata(id, ColumnMetadata.named("ID").withIndex(1).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(goodsBaseId, ColumnMetadata.named("GOODS_BASE_ID").withIndex(2).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(goodsType, ColumnMetadata.named("GOODS_TYPE").withIndex(3).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(goodsCategory, ColumnMetadata.named("GOODS_CATEGORY").withIndex(4).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(barCode, ColumnMetadata.named("BAR_CODE").withIndex(5).ofType(Types.VARCHAR).withSize(16));
        addMetadata(skuCode, ColumnMetadata.named("SKU_CODE").withIndex(6).ofType(Types.VARCHAR).withSize(22));
        addMetadata(price, ColumnMetadata.named("PRICE").withIndex(7).ofType(Types.DECIMAL).withSize(12).withDigits(3).notNull());
        addMetadata(seqOrder, ColumnMetadata.named("SEQ_ORDER").withIndex(8).ofType(Types.INTEGER).withSize(32).notNull());
        addMetadata(photo, ColumnMetadata.named("PHOTO").withIndex(9).ofType(Types.BLOB).withSize(2147483647));
        addMetadata(statusFlag, ColumnMetadata.named("STATUS_FLAG").withIndex(10).ofType(Types.CHAR).withSize(1).notNull());
        addMetadata(version, ColumnMetadata.named("VERSION").withIndex(11).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(crtTime, ColumnMetadata.named("CRT_TIME").withIndex(12).ofType(Types.TIMESTAMP).withSize(26).withDigits(6).notNull());
        addMetadata(crtWho, ColumnMetadata.named("CRT_WHO").withIndex(13).ofType(Types.VARCHAR).withSize(22).notNull());
        addMetadata(updTime, ColumnMetadata.named("UPD_TIME").withIndex(14).ofType(Types.TIMESTAMP).withSize(26).withDigits(6));
        addMetadata(updWho, ColumnMetadata.named("UPD_WHO").withIndex(15).ofType(Types.VARCHAR).withSize(22));
        addMetadata(templateId, ColumnMetadata.named("TEMPLATE_ID").withIndex(16).ofType(Types.VARCHAR).withSize(22).notNull());
    }

    @Override
    public Goods newEntity() {
        return new Goods();
    }

    @Override
    public Object getFieldValue(Goods entity, String fieldName) {
        switch (fieldName) {
            case "id":
                return entity.getId();
            case "goodsBaseId":
                return entity.getGoodsBaseId();
            case "goodsType":
                return entity.getGoodsType();
            case "goodsCategory":
                return entity.getGoodsCategory();
            case "barCode":
                return entity.getBarCode();
            case "skuCode":
                return entity.getSkuCode();
            case "price":
                return entity.getPrice();
            case "seqOrder":
                return entity.getSeqOrder();
            case "photo":
                return entity.getPhoto();
            case "statusFlag":
                return entity.getStatusFlag();
            case "version":
                return entity.getVersion();
            case "crtTime":
                return entity.getCrtTime();
            case "crtWho":
                return entity.getCrtWho();
            case "updTime":
                return entity.getUpdTime();
            case "updWho":
                return entity.getUpdWho();
            case "templateId":
                return entity.getTemplateId();
            default:
                return super.getFieldValue(entity, fieldName);
        }
    }

    @Override
    public void setFieldValue(Goods entity, String fieldName, Object value) {
        switch (fieldName) {
            case "id":
                entity.setId((java.lang.String) value);
                break;
            case "goodsBaseId":
                entity.setGoodsBaseId((java.lang.String) value);
                break;
            case "goodsType":
                entity.setGoodsType((net.apexes.demo.codegen.entity.enums.GoodsType) value);
                break;
            case "goodsCategory":
                entity.setGoodsCategory((net.apexes.demo.codegen.entity.enums.GoodsCategory) value);
                break;
            case "barCode":
                entity.setBarCode((java.lang.String) value);
                break;
            case "skuCode":
                entity.setSkuCode((java.lang.String) value);
                break;
            case "price":
                entity.setPrice((java.math.BigDecimal) value);
                break;
            case "seqOrder":
                entity.setSeqOrder((java.lang.Integer) value);
                break;
            case "photo":
                entity.setPhoto((byte[]) value);
                break;
            case "statusFlag":
                entity.setStatusFlag((net.apexes.demo.codegen.entity.enums.StatusFlag) value);
                break;
            case "version":
                entity.setVersion((java.lang.String) value);
                break;
            case "crtTime":
                entity.setCrtTime((java.time.LocalDateTime) value);
                break;
            case "crtWho":
                entity.setCrtWho((java.lang.String) value);
                break;
            case "updTime":
                entity.setUpdTime((java.time.LocalDateTime) value);
                break;
            case "updWho":
                entity.setUpdWho((java.lang.String) value);
                break;
            case "templateId":
                entity.setTemplateId((java.lang.String) value);
                break;
            default:
                super.setFieldValue(entity, fieldName, value);
                break;
        }
    }

}

